-
Notifications
You must be signed in to change notification settings - Fork 28
feat: add pypi attestation discovery #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ben Selwyn-Smith <[email protected]>
b97a9cb
to
a362d7c
Compare
Signed-off-by: Ben Selwyn-Smith <[email protected]>
2df212b
to
6d7cf95
Compare
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
@@ -83,6 +103,13 @@ def _load_provenance_file_content( | |||
# Some provenances, such as Witness may not include the DSSE envelope `dsseEnvelope` | |||
# property but contain its value directly. | |||
provenance_payload = provenance.get("payload", None) | |||
if not provenance_payload: | |||
# GitHub Attestation. | |||
# TODO Check if old method (above) actually works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could a doc string be added here - to explain the reason why there is a change in handling Github attestation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps @behnazh-w could weigh in on this?
raise ValueError(f"Missing certificate value: {name}") | ||
|
||
# Values are DER encoded UTF-8 strings. Removing the first two bytes seems to be sufficient. | ||
value: str = certificate_claims[name][2:].decode("UTF-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we perform this operation in the first loop ?
for extension in certificate.extensions:
...
I think the purpose of this loop is for validating certificate_claims
content, so in my opinion, it's best if we don't do extra mutation to certificate_claims
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have combined the loops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It looks okay to me. Just a small observation that the logic for checking whether certificate_claims
contains enough claim names (e.g. source_repo, source_digest, etc.) has been removed in the latest commit. Just want to make sure that this is intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I'll add it back in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have finished my round of review. Thank you.
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for addressing the feedbacks.
Summary
This PR adds discovery of PyPI attestation. URLs to these attestation files are sought via the deps.dev API.
Description of changes
DepsDevRepoFinder
was updated to use theDepsDevService
, ensuring consistent and easily configurable use of the APIDepsDevRepoFinder
functions (they were not added previously), including for the functions that PyPI attestation discovery relies upon.pypi-attestation
is used to extract information from the attestation certificate. This information is coerced into a predicate for use elsewhere within Macaron.ultralytics
Python library as its target.Related issues
Closes #947